using System;
using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.Ccr.Core;
using Microsoft.Dss.Core.Attributes;
using Microsoft.Dss.ServiceModel.Dssp;
using Microsoft.Dss.ServiceModel.DsspServiceBase;
using W3C.Soap;
using Emgu.CV;
using Emgu.CV.Structure;
using Emgu.CV.UI;
using System.Drawing;
using System.Windows.Forms;
using Robotics.ImgErode;

namespace Robotics.ImgErode
{
    /// <summary>
    /// ImgErode contract class
    /// </summary>
    public sealed class Contract
    {
        /// <summary>
        /// DSS contract identifer for ImgErode
        /// </summary>
        [DataMember]
        public const string Identifier = "http://schemas.tempuri.org/2010/08/imgerode.html";
    }

    /// <summary>
    /// ImgErode state
    /// </summary>
    [DataContract]
    public class ImgErodeState
    {
        /// <summary>
        /// Erosion Iterations
        /// </summary>
        [DataMember]
        [Description("Specifies the number of Erosion iterations.")]
        public int Iterations;
    }

    /// <summary>
    /// ImgErode main operations port
    /// </summary>
    [ServicePort]
    public class ImgErodeOperations : PortSet<DsspDefaultLookup, DsspDefaultDrop, Get, Subscribe, ErodeImage, NotifyImageErosion>
    {
    }

    /// <summary>
    /// ImgErode get operation
    /// </summary>
    public class Get : Get<GetRequestType, PortSet<ImgErodeState, Fault>>
    {
        /// <summary>
        /// Creates a new instance of Get
        /// </summary>
        public Get()
        {
        }

        /// <summary>
        /// Creates a new instance of Get
        /// </summary>
        /// <param name="body">the request message body</param>
        public Get(GetRequestType body)
            : base(body)
        {
        }

        /// <summary>
        /// Creates a new instance of Get
        /// </summary>
        /// <param name="body">the request message body</param>
        /// <param name="responsePort">the response port for the request</param>
        public Get(GetRequestType body, PortSet<ImgErodeState, Fault> responsePort)
            : base(body, responsePort)
        {
        }
    }

    /// <summary>
    /// Image Erosion operation
    /// </summary>
    public class ErodeImage : Update<ErodeImageRequest, PortSet<DefaultUpdateResponseType, Fault>>
    {
        public ErodeImage()
        {
        }

        /// <summary>
        /// Constructor with ErodeImageRequest
        /// </summary>
        public ErodeImage(ErodeImageRequest body)
            : base(body)
        {
        }
    }

    /// <summary>
    /// Erode Image Request Type
    /// </summary>
    [DataContract]
    [DataMemberConstructor]
    public class ErodeImageRequest
    {
        [DataMember, DataMemberConstructor]
        [Description("Data for Input Image")]
        public byte[, ,] ImageForErosion;

        /// <summary>
        /// Constructor
        /// </summary>
        public ErodeImageRequest()
        {
        }
        /// <summary>
        /// Constructor with Image Data Request (byte[,,])
        /// </summary>
        public ErodeImageRequest(byte[, ,] request)
        {
            ImageForErosion = request;
        }
    }

    /// <summary>
    /// Image Erosion Notification Operation
    /// </summary>
    [DisplayName("ImageEroded")]
    [Description("Indicates that image has been Eroded.")]
    public class NotifyImageErosion : Update<ErosionResult, PortSet<DefaultUpdateResponseType, Fault>>
    {
        /// <summary>
        /// Constructor
        /// </summary>
        public NotifyImageErosion()
        {
        }

        /// <summary>
        /// Constructor with ErosionResult
        /// </summary>
        public NotifyImageErosion(ErosionResult body)
            : base(body)
        {
        }
    }

    /// <summary>
    /// Image Erosion Result
    /// </summary>
    [DataContract]
    public class ErosionResult
    {
        /// <summary>
        /// Erosion Result
        /// </summary>
        [DataMember]
        [Description("The resulting Eroded image")]
        public byte[, ,] ImageEroded;

        /// <summary>
        /// Constructor
        /// </summary>
        public ErosionResult()
        {
        }
        /// <summary>
        /// Constructor with Image Data Result (byte[,,])
        /// </summary>
        public ErosionResult(byte[, ,] result)
        {
            ImageEroded = result;
        }
    }

    /// <summary>
    /// ImgErode subscribe operation
    /// </summary>
    public class Subscribe : Subscribe<SubscribeRequestType, PortSet<SubscribeResponseType, Fault>>
    {
        /// <summary>
        /// Creates a new instance of Subscribe
        /// </summary>
        public Subscribe()
        {
        }

        /// <summary>
        /// Creates a new instance of Subscribe
        /// </summary>
        /// <param name="body">the request message body</param>
        public Subscribe(SubscribeRequestType body)
            : base(body)
        {
        }

        /// <summary>
        /// Creates a new instance of Subscribe
        /// </summary>
        /// <param name="body">the request message body</param>
        /// <param name="responsePort">the response port for the request</param>
        public Subscribe(SubscribeRequestType body, PortSet<SubscribeResponseType, Fault> responsePort)
            : base(body, responsePort)
        {
        }
    }
}


